const http = require("http");
const url = require("url");

// 使用 url.parse()方法将路径解析为一个方便操作的对象
var rurl = "http://localhost:8081";
var options = url.parse(rurl);

options.method = "POST";
var userName = process.argv[2];
var password = process.argv[3];
var user = {
    username: userName,
    password: password,
};

var juser = JSON.stringify(user);

var request = http.request(options, (res) => {
    res.pipe(process.stdout);
});
request.write(juser);
request.end();
